---@class ZEventCenter : Singleton
---@field public dispatch EventDispatch
local this = BaseClass("ZEventCenter", Singleton)

function this:__ctor()
    self.dispatch = EventDispatch()
end

---@param isAddRem boolean
---@param eType string|number
---@param eFunc function
function this:UPEventListener(isAddRem, eType, eFunc)
    if isAddRem then
        self.dispatch:AddEventListener(eType, eFunc)
    else
        self.dispatch:RemoveEventListener(eType, eFunc)
    end
end

---@param ev ZEvent
function this:DispatchEvent(ev)
    self.dispatch:DispatchEvent(ev)
end

function this:AddEventListener(eType, eFunc)
    self.dispatch:AddEventListener(eType, eFunc)
end

function this:RemoveEventListener(eType, eFunc)
    self.dispatch:RemoveEventListener(eType, eFunc)
end

function this:RemoveEventListener(eType)
    self.dispatch:RemoveEventListener(eType)
end

ZEventCenter = this